package lab02.test26;

import java.util.Scanner;

public class ExceptionTest {
    public static void main(String[] args) {
        System.out.println("请输入两个数.");
        Scanner sc = new Scanner(System.in);
        int number1 = sc.nextInt();
        int number2 = sc.nextInt();
        try {
            int number3 = number1 / number2;
            System.out.println(number1 + "/" + number2 + "=" + number3);
        }catch (Exception e) {
            System.out.println("除数为0,程序异常.");
        } finally {
            System.out.println("程序结束.");      //无论程序是否异常，finally语句都会执行0。
        }
    }
}
